define(function (require, exports, module) {
        exports.init = function (element, cb) {
                var basic=require('basic');
                var jsonAPI = require('json-api');
                var mustache = require('mustache');

                $("#title").text('我的优惠券');
                defineModule({
                        listCoupon:function(cb)
                        {
                                var mobile=basic.getLoginUser();
                                jsonAPI.restful('/api/verifyCoupon/list', {mobile:mobile}, function (err, result) {
                                        if (jsonAPI.handleErrors(err, result)) {
                                                var tpl = $('#tpl_coupon').html();
                                               var content = mustache.render(tpl, mustache.normalizeInput(result));
                                                $('#CouponList').html(content);
                                          /*      var data = result.result;
                                                var str='';
                                                for (var i = 0; i < data.length; i++) {
                                                        var mincount = "";
                                                        if (data[i].mincount)
                                                                mincount = '<p class="c3 ft12">消费满 ' + data[i].mincount + ' 元使用</p>';
                                                        str+='<li class="mt10 rel"><p class="ft15">' + data[i].description + '</p>' + mincount + '<p class="c3 ft12 mt5">过期时间：&nbsp;' + data[i].expirationdate + '</p><p class="tc c7 bgc3 abs yuan"><span class="ft30">' + data[i].discount + '</span>&nbsp;元</p></li>';
                                                }
                                                alert(str);*/
                                        }
                                        cb && cb();
                                });
                        }
                })

                $module.listCoupon(function(){
                        cb && cb();
                })
        };
});